﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using SCSService;

namespace SCS.Core.Models.ModelsFontend
{
    public class UserWebModel
    {
        public static SCSService.Security_User LoginUser(string userName, string password)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.LogInUser(userName, password);
        }

        public static SCSService.Security_User GetUerByID(int id)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.GetUserByID(id);
        }

        public static void ChangePassword(SCSService.Security_User user)
        {
            SCSService.UserService userSvc = new UserService();
            userSvc.ChangePassword(user);
        }

        public static int CreateUser(SCSService.Security_User user)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.CreateUser(user);
        }

        public static int CreateCustomer(SCSService.Customer customer)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.CreateCustomer(customer);
        }

        public static int CreateLog(SCSService.Security_User_Log log)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.CreateLog(log);
        }

        public static int GetCountUserByUserName(string userName)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.GetUserByUserName(userName);
        }

        public static int GetCountUserByEmail(string email)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.GetUserbyEmail(email);
        }

        public static SCSService.Security_User UserForgotPassword(string userName, string email)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.GetUserByUserNameAndEmail(userName, email);
        }

        public static List<SCSService.System_Website> GetListWebsiteByUserCustomer(int userID)
        {
            SCSService.ConfigService configSvc = new ConfigService();
            return configSvc.GetListWebsiteByUser(userID, 3);    //@3 perId cua Customer
        }

        public static void CreateWebsiteUser(Security_Website_User webUser)
        {
            SCSService.UserService userSvc = new UserService();
            userSvc.CreateWebsiteUser(webUser);
        }

        public static SCSService.Security_Permission GetPermissionUser(int id)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.GetPermissionByUserID(id);
        }

        public static int GetCountWebsiteByDomain(string domain)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.GetWebsiteByDomain(domain);
        }

        public static void UpdateUser(Security_User user)
        {
            SCSService.UserService userSvc = new UserService();
            userSvc.UpdateUser(user);
        }

        public static void UpdateCustomer(Customer cus)
        {
            SCSService.UserService userSvc = new UserService();
            userSvc.UpdateCustomer(cus);
        }

        public static List<Customer_Order> GetListOrderByCustomerID(int? id, int? status, DateTime? startDate, DateTime? endDate, int siteGuid, string order_search)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.GetListOrderByCustomerID(id,status,startDate,endDate,siteGuid,order_search);
        }

        public static List<Detail_Order> CustomerOrderDetail(int? id)
        {
            SCSService.UserService userSvc = new UserService();
            return userSvc.CustomerOrderDetail(id);
        }
    }
}